<?php

namespace app\api\controller\stall;

use app\api\controller\Controller;
use app\api\model\stall\Apply as ApplyModel;
use app\common\service\qrcode\PosterService;

class Qrcode extends Controller
{
    // 当前用户
    private $user;
    // 分销商用户信息
    private $Agent;
    // 分销商设置
    private $setting;

    /**
     * 构造方法
     */
    public function initialize()
    {
        // 用户信息
        $this->user = $this->getUser();
        // 分销商用户信息
        $this->Agent = ApplyModel::getdetail(['user_id'=>$this->user['user_id'],'apply_status'=>20]);;
    }

    public function poster($source)
    {
        $Qrcode = new PosterService($this->Agent, $source);
        $PosterAry = $Qrcode->getStallImage();
        return $this->renderSuccess('', [
            'user_qrcode' => $PosterAry
        ]);
    }
}